package jjn.acwing.algorithm_basic.chapter1.big_number;

import java.util.ArrayList;
import java.util.List;
import java.util.Scanner;

public class Acwing791 {
    static List<Integer> strToDigits(String num) {
        int n = num.length();
        List<Integer> res = new ArrayList<>(n);
        for (int i = n - 1; i >= 0; i--) {
            int digit = num.charAt(i) - '0';
            res.add(digit);
        }
        return res;
    }
    
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        String a = sc.next();
        String b = sc.next();
        List<Integer> digitA = strToDigits(a);
        List<Integer> digitB = strToDigits(b);
        List<Integer> result = new ArrayList<>();
        int carry = 0;
        int m = 0, n = 0;
        while (m < digitA.size() || n < digitB.size()) {
            int first = (m < digitA.size()) ? digitA.get(m) : 0;
            int second = (n < digitB.size()) ? digitB.get(n) : 0;
            int sum = first + second + carry;
            carry = sum / 10;
            int rest = sum % 10;
            result.add(rest);
            m++;
            n++;
        }
        if (carry > 0) {
            result.add(carry);
        }
        for (int i = result.size() - 1; i >= 0; i--) {
            System.out.printf("%d", result.get(i));
        }
        System.out.println();
    }
}